﻿using System;
using System.Collections.Generic;
using System.Text;
using Vortex.Wrapper.Direct3D;
using Vortex.IO;

namespace Vortex.Drawing {

	/// <summary>
	/// Managed shader include processor
	/// </summary>
	class ShaderIncludeProcessor : D3DXShaderInclude {
		private static readonly string SYSTEM_INCLUDE_PREFIX = "Vortex.Drawing.Files.";

		/// <summary>
		/// Gets the content of including shader file.
		/// </summary>
		/// <param name="includeType">Type of the include.</param>
		/// <param name="fileName">Name of the included file.</param>
		/// <returns></returns>
		public override string GetFileContent(ShaderIncludeType includeType, string fileName) {
			if (includeType == ShaderIncludeType.System) {
				fileName = SYSTEM_INCLUDE_PREFIX + fileName;
			}
			ResourceFileInfo file = new ResourceFileInfo(fileName);
			return file.GetContentAsText();
		}
	}
}
